package com.company.game.domain;

import xyz.noark.core.annotation.Gzip;
import xyz.noark.core.annotation.PlayerId;
import xyz.noark.core.annotation.orm.*;

import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.LongAdder;

@Entity
@Table(name = "player_item_10", comment = "道具表")
public class PlayerItem {

    @Id
    @Column(name = "id", comment = "道具ID")
    private Long id;

    @PlayerId
    @Column(name = "player_id", nullable = false, comment = "玩家ID")
    private Long playerId;

    @Column(name = "template_id", length = 5, nullable = false, defaultValue = "0", comment = "道具ID")
    private String templateId;

    @Column(name = "level", nullable = false, defaultValue = "1", comment = "等级")
    private int level;

    @Column(name = "select", nullable = false, defaultValue = "true", comment = "测试关键字")
    private boolean select;

    @Json
    @Column(name = "json", comment = "json", defaultValue = "{}", nullable = false)
    private PlayerItemJson json;

    @Gzip
    @Blob
    @Column(name = "blob", comment = "blob", defaultValue = "{}", nullable = false)
    private PlayerItemJson blob;

    @Column(name = "count", comment = "计数器", defaultValue = "0", nullable = false)
    private AtomicInteger count = new AtomicInteger(123);
    @Column(name = "count_long", comment = "计数器", defaultValue = "0", nullable = false)
    private AtomicLong  countLong = new AtomicLong(123457890123456L);
    @Column(name = "count_adder", comment = "计数器", defaultValue = "0", nullable = false)
    private LongAdder  countAdder = new LongAdder();

    @CreatedDate
    @Column(name = "create_time", nullable = false, comment = "创建时间", defaultValue = "2018-07-06 05:04:03")
    private Date createTime;
    @LastModifiedDate
    @Column(name = "modified_time", nullable = false, comment = "最后修改时间", defaultValue = "2018-07-06 05:04:03")
    private Date modifiedTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getPlayerId() {
        return playerId;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public boolean isSelect() {
        return select;
    }

    public void setSelect(boolean select) {
        this.select = select;
    }


    public void setPlayerId(Long playerId) {
        this.playerId = playerId;
    }

    public String getTemplateId() {
        return templateId;
    }

    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModifiedTime() {
        return modifiedTime;
    }

    public void setModifiedTime(Date modifiedTime) {
        this.modifiedTime = modifiedTime;
    }

    public PlayerItemJson getBlob() {
        return blob;
    }

    public void setBlob(PlayerItemJson blob) {
        this.blob = blob;
    }

    public PlayerItemJson getJson() {
        return json;
    }

    public void setJson(PlayerItemJson json) {
        this.json = json;
    }

    public AtomicInteger getCount() {
        return count;
    }

    public void setCount(AtomicInteger count) {
        this.count = count;
    }

    public AtomicLong getCountLong() {
        return countLong;
    }

    public void setCountLong(AtomicLong countLong) {
        this.countLong = countLong;
    }

    public LongAdder getCountAdder() {
        return countAdder;
    }

    public void setCountAdder(LongAdder countAdder) {
        this.countAdder = countAdder;
    }
}
